/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import model.Arquivar;
import util.jpaUtil;
/**
 *
 * @author calandreli
 */
public class ArquivaDAO extends JPAHibernateDAO {

    @Override
    public Class obterClasse() {
        return Arquivar.class;
    }
    
    
    public List<Arquivar> pesquisaPorProcesso(int cod) {
        EntityManager em = jpaUtil.getEntityManager();
        Query query = em.createQuery("Select a from Arquivar a where a.processo.id_Processo =:codProc");
        query.setParameter("codProc", cod);
        return query.getResultList();
    }
    
    public List<Arquivar> pesquisaPorProcessoPeloNumero(String cod) {
        EntityManager em = jpaUtil.getEntityManager();
        Query query = em.createQuery("Select a from Arquivar a where a.processo.numeroProcesso =:codProc");
        query.setParameter("codProc", cod);
        return query.getResultList();
    }
    
}